/*
 * Copyright (C) 2008-2010 Oliver Horn.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.googlecode.funcj;

import javax.annotation.Nullable;

/**
 * A function with 2 arguments.
 *
 * @param <F1> the type of the first argument
 * @param <F2> the type of the second argument
 * @param <T> the type of the result
 *
 * @author Oliver Horn
 *
 * @see com.google.common.base.Function
 */
public interface Function2<F1, F2, T> {

	/**
	 * Applies the function to two arguments of type {@code F1} and {@code F2}, resulting in an object
	 * of type {@code T}.
	 *
	 * @param arg1 the first argument
	 * @param arg2 the second argument
	 * @return the resulting object
	 */
	public T apply(@Nullable F1 arg1, @Nullable F2 arg2);

	/**
	 * Indicates whether some other object is equal to this {@code Function2}.
	 * This method can return {@code true} <i>only</i> if the specified object is
	 * also a {@code Function2} and, for every arguments, it returns exactly
	 * the same value.
	 *
	 * <p>Note that it is always safe <em>not</em> to override
	 * {@link Object#equals}.
	 */
	public boolean equals(Object obj);
}
